/**
 *	Author:     Kevin.du
 *	CreateTime: 2010-8-2-上午09:49:11
 *	ProjectName:51gen
 *	ClassName:  BaseDao.java
 *
 *	This Class Or Method Create by Kevin.du 
 *
 *	Copyright ownership belongs to Vilii Kevin, shall not be reproduced , 
 *	copied, or used in other ways without permission.
 *	Otherwise Vilii.Kevin will have the right to pursue legal responsibilities. 
 **/
package com.kevin.ssh2jquery.dao;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import java.util.Map;

import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.criterion.DetachedCriteria;

/**
 * 基础操作接口
 * 
 * @author kevin.du
 */
@SuppressWarnings("unchecked")
public interface BaseDao {
	/**
	 * 保存信息
	 * 
	 * @param object
	 * @return
	 */
	public boolean save(Object object);

	/**
	 * 删除信息
	 * 
	 * @param object
	 * @return
	 */
	public boolean delete(Object object);

	/**
	 * 更新信息
	 * 
	 * @param object
	 * @return
	 */
	public boolean update(Object object);

	/**
	 * 保存或更新信息
	 * 
	 * @param object
	 * @return
	 */
	public boolean saveOrUpdate(Object object);

	/**
	 * 批量更新或保存
	 * 
	 * @param coll
	 * @return
	 */
	public boolean saveOrUpdateAll(Collection<Object> coll);

	/**
	 * 通过编号查找信息
	 * 
	 * @param cls
	 * @param ser
	 * @return
	 */
	public Object findByCode(Class cls, Serializable ser);

	public List findByDetached(DetachedCriteria dc);

	public List getResultByHql(String hql, Map<String, ?> params);

	public Object getResultSumByHql(String hql, Map<String, ?> params);

	public long getResultSizeByHql(String hql, Map<String, ?> params);

	public Session getSessionObj();

	public List getResultByHql(String Hql);

	public List getResultByCriteria(Criteria cr);
}
